package com.itheima.chapter08.list;
//方法

import java.util.LinkedList;

public class linkedlistdemo1 {
    public static void main(String[] args) {
        LinkedList<String> list =new LinkedList<>();
        list.add("a");
        list.add("b");
        list.add("c");
        list.add("e.txt");
        add(list);
        get(list);
        remove(list);

    }

    private static void remove(LinkedList<String> list) {
        String first = list.removeFirst();
        System.out.println(first);
        String last = list.removeLast();
        System.out.println(last);
        System.out.println(list);
    }

    private static void get(LinkedList<String> list) {
        String first = list.getFirst();
        System.out.println(first);
        String last = list.getLast();
        System.out.println(last);
    }

    private static void add(LinkedList<String> list) {
        list.addFirst("q1");
        list.addLast("q7");
        System.out.println(list);
    }
}
